/**
 * \class GenAddExp.h /GenProg/AbsSyn/GenExpClasses/GenAddExp.h
 *
 *  \date 18 maj 2012
 *  \author ytc0039
 *  
 *  \brief 
 */

#ifndef GENADDEXP_H_
#define GENADDEXP_H_
#include <AbsSyn/AbsSyn.h>
#include <Generator/GenExp.h>
#include <AbsSyn/AddExp.h>
#include <Interfaces/IGenExp.h>

class GenAddExp : public IGenExp
{

private:
	AddExp::genAddExp m_GenFun;

public:

	explicit GenAddExp(AddExp::genAddExp genFun):
		m_GenFun(genFun)
	{

	}

	virtual AbsSyn::IExpPtr genExp(GenExp::GenExpPtr genExpPtr) const
	{
		return m_GenFun(*genExpPtr);
	}

	virtual int getExpNrArg() const
	{
		return 2;
	}

	/**
	 *  \brief Does the type match the expression
	 *
	 *  When the generator creates a new expression
	 *  it is necessary to know if the type matches
	 *  the choosen expression.
	 *
	 * @param type
	 * @return true if it matches
	 */
	virtual bool isTypeMatch(TypeEnum type) const{
		bool ret = false;
		if( type == TypeEnum::DoubleT ||
			type == TypeEnum::IntT)
		{
			ret = true;
		}

		return ret;
	}



};

#endif /* GENADDEXP_H_ */
